<!doctype html>
<html>
	<head>
		<meta charset="utf-8">
		<meta name="viewport" content="maximum-scale=1.0,minimum-scale=1.0,user-scalable=0,width=device-width,initial-scale=1.0"/>
		<meta name="format-detection" content="telephone=no" />
		<title>速翔网络 - QQ技术：1424445608</title>
		<link rel="stylesheet" type="text/css" href="../css/aui.css" />
		<link rel="stylesheet" type="text/css" href="../css/login.css" />
	</head>
	<body>
		<!--	<section class="aui-grid fx-top">
		<div class="aui-row">
		<div class="aui-col-xs-6 chait" data-id='1' style="border-right: 1px solid #e8e8e8;" Tapmode onclick="xuan(this,1)">
		<div class="aui-grid-label">
		手机登录
		</div>
		</div>
		<div class="aui-col-xs-6" data-id='2' Tapmode onclick="xuan(this,2)">
		<div class="aui-grid-label">
		邮箱登录
		</div>
		</div>
		</div>
		</section>-->
		<div class="aui-content aui-margin-b-15 fx-yejian-by" style="padding-top: 50px;">
			<ul class="aui-list aui-form-list" id="login-1">
				<li class="aui-list-item" id="mobile">
					<div class="aui-list-item-inner">
						<div class="aui-list-item-input">
							<input type="tel" placeholder="请输入手机号" value="">
						</div>
					</div>
				</li>
				<li class="aui-list-item" id="yzm">
					<div class="aui-list-item-inner">
						<div class="aui-list-item-input">
							<input type="password" placeholder="请输入密码" value="">
						</div>
					</div>
				</li>

			</ul>
			<ul class="aui-list aui-form-list" id="login-2" style="display: none">
				<li class="aui-list-item" id="mobile">
					<div class="aui-list-item-inner">
						<div class="aui-list-item-input">
							<input type="text" placeholder="请输入手机号">
						</div>
					</div>
				</li>
				<li class="aui-list-item" id="pwa">
					<div class="aui-list-item-inner">
						<div class="aui-list-item-input">
							<input type="password" placeholder="请输入密码">
						</div>
						<div class="aui-list-item-label-icon fx-yzm" style="color: #212121 !important;width: 90px !important;">
							忘记密码？
						</div>
					</div>
				</li>
			</ul>
		</div>
		<div class="aui-content aui-margin-b-15 fx-login fx-yejian-by">
			<div class="aui-btn aui-btn-danger aui-btn-block aui-btn-sm" Tapmode onclick="login()">
				登录
			</div>

			<div class="fx-login-b">
				<span class="aui-pull-left" Tapmode onclick="_url({url:'reg',title:'手机注册'})">手机注册</span><span class="aui-pull-right" Tapmode onclick="_url({url:'pwd',title:'密码找回'})">密码找回</span>
			</div>
		</div>
		<div class="aui-content fx-b fx-yejian-by fx-yijiandengl" style="display: none">
			<div class="fx-shanghuaxian"></div>
			<div class="fx-b-title">
				一键登录
			</div>
			<div class="aui-grid">
				<div class="aui-row URLwai">
					<div class="aui-col-xs-4" tapmode data-id="wx">
						<img src="../image/wx.png" />
						<div class="aui-grid-label">
							微信
						</div>
					</div>
					<div class="aui-col-xs-4" tapmode data-id="qq">
						<img src="../image/qq.png" />
						<div class="aui-grid-label">
							QQ
						</div>
					</div>
					<div class="aui-col-xs-4" tapmode data-id="wb">
						<img src="../image/weibo.png" />
						<div class="aui-grid-label">
							微博
						</div>
					</div>
				</div>
			</div>
		</div>
	</body>
	<script type="text/javascript" src="../script/zepto.min.js"></script>
	<script type="text/javascript" src="../script/fastclick.js"></script>
	<script type="text/javascript" src="../script/api.js"></script>
	<script type="text/javascript" src="../script/ffxiang.js"></script>
	<script type="text/javascript">
		apiready = function() {
			FastClick.attach(document.body);
			// 监听夜间
			api.addEventListener({
			    name: 'yejian'
			}, function(ret, err) {
				if(ret){
					_yejians();
				}
			});
			$('.URLwai div').click(function() {
				_loading()
				var id = $(this).data('id');
				_loginTyle(id)
			})
			if(!$api.getStorage('app')){
				$('.fx-yijiandengl').removeAttr('style')
			}
		}
		function xuan(job, type) {
			$('.fx-top .aui-row div').removeClass('chait');
			$(job).addClass('chait');
			if (type == 2) {
				$('#login-1').hide();
				$('#login-2').show();
				$('#shuoming').hide();
			} else {
				$('#login-1').show();
				$('#login-2').hide();
				$('#shuoming').show();
			}
		}

		function login() {
			var type = $('.fx-top .aui-row div.chait').data('id')
			type = 1
			if (type == 1) {
				var username = $('#login-1 #mobile input').val();
				var password = $('#login-1 #yzm input').val();
				if (!_isMobile(username)) {
					_msg('手机号码不正确！')
					return;
				}
				if (!yzm) {
					_msg('请输入验证码！')
					return;
				}
			} else {
				var username = $('#login-2 #mobile input').val();
				var password = $('#login-2 #yzm input').val();
				if (!_isMobile(username)) {
					_msg('手机号码不正确！')
					return;
				}
				if (!pwa) {
					_msg('请输入密码！')
					return;
				}
			}
			_loading()
			_ajax('api/user/login', function(ret, err) {
				if (ret.ret) {

					// console.info("ret-----" + JSON.stringify(ret))
					_ajax('api/member/info', function(rets, errs) {
						// console.info("rets------" + JSON.stringify(rets))
						// console.info("errs------" + JSON.stringify(errs))
						if (rets.ret) {
							_loadingCloes()
							$api.setStorage('token', ret.ret);
							$api.setStorage('user', rets.ret);
							api.execScript({
							    name: 'root',
							    frameName: 'ffxiang_win',
							    script: 'rongyun_init()'
							});
//							_msg('登录成功')
//					    	setTimeout(function(){
//					    		_hone();
//					    	},1000)
					    	_msg('登录成功')
					    	api.sendEvent({
							    name: 'ext',
							    extra: {
							        key1: 'value1',
							    }
							});
					    	setTimeout(function(){
					    		_hone()
					    	},1000)
						} else {
							_loadingCloes()
							_msg(rets.err)
						}
					}, {
						token : ret.ret
					})
				} else {
					_loadingCloes()
					_msg(ret.err)
				}
			}, {
				username : username,
				password : password
			})
		}


	</script>
</html>
